<html>
<head>

<script id='vertex' type='x-shader/x-vertex'>
attribute vec3 aVertexPosition;
uniform mat4 uPMatrix;
uniform mat4 uMVMatrix;
uniform mat3 uNMatrix;
uniform vec3 uColor;
varying vec3 vColor;

void main() {
    gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
    float weight = max(dot(uNMatrix * aVertexPosition, vec3(-0.4, 0.4, 0.7)),
    				   0.0);
    vColor = uColor + vec3(1.0, 1.0, 1.0) * weight;
}
</script>

<script id='fragment' type='x-shader/x-fragment'>
precision mediump float;
varying vec3 vColor;

void main() {
    gl_FragColor = vec4(vColor, 1.0);
}
</script>

</head>
</html>